#include "global.h"
#include<stdlib.h>

FILE* fp=NULL;
int   tableSize=0;
char* in=(char*)calloc(MAXINPUT,sizeof(char));
char* out=(char*)calloc(MAXOUTPUT,sizeof(char));

char* symTable=(char*)calloc(MAXTABLESIZE,sizeof(char));
char* topTable=symTable+MAXTABLESIZE-1;
char* btmTable=topTable;

int Read(){
    int c;
    int i=0;
    while((c = getchar()) != EOF && i < MAXINPUT-1){
        in[i++]=c;
    }
    in[i]='\0';
    return 0;
}
int Print(){
    printf("%s\n%s\n",in,out);
    return 0;
}
void table(){
    int i=0;
    char* p=topTable;
    char* maxTable=symTable+MAXTABLESIZE-1;
    printf("\n");
    while(p<=maxTable){
        printf("[%d:%d]",i++,*(p++));
    }
    printf("\n");
}
int main(){
    printf("TABLE!\n");
    printf("READ!\n");
    Read();
    printf("EVAL!\n");
    Eval({in,out,symTable,0,0});
    printf("PRINT!\n");
    Print();
    return 0;
}
